#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
void reverse(int* a, int begin, int end)
{
    while (begin < end)
    {
        int tmp = 0;
        tmp = a[begin];
        a[begin] = a[end];
        a[end] = tmp;
        begin++;
        end--;
    }
}
void rotate(int* nums, int numsSize, int k) {
    if (k >= numsSize)
        if (k >= numsSize)
            k %= numsSize;
    reverse(nums, 0, numsSize - k - 1);
    reverse(nums, numsSize - k, numsSize - 1);
    reverse(nums, 0, numsSize - 1);
}